package com.cl.util;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

public class ClassNameReplaceUtil {
	private static Map<String,String> classNameMap;
	
	static{
	  classNameMap=new HashMap<String,String>();
	  classNameMap.put("dao.hb.Thesis","论文条目");
	  classNameMap.put("dao.hb.Doc", "文稿");
	  classNameMap.put("dao.hb.AudioVideo", "音视频"); 
	  classNameMap.put("dao.hb.Relic", "文物");   
	  classNameMap.put("dao.hb.Image", "影像");   
	  
	  classNameMap.put("dao.hb.Figure", "人物");   
	  classNameMap.put("dao.hb.Lemma", "词条");   
	  classNameMap.put("dao.hb.CeAttachment", "附件");   
	  classNameMap.put("dao.hb.Building", "建筑");   

	}
	public static String replaceName(String entity){
		Iterator iter = classNameMap.entrySet().iterator();
		while (iter.hasNext()) {
			Map.Entry entry = (Map.Entry) iter.next();
			String key = entry.getKey().toString();
			if(entity.equals(key)){
				entity = entry.getValue().toString();
//				entity = entry.getKey().toString();
			}
		}
	
		return entity;
	}
	
	public static String replaceName1(String entity){
		Iterator iter = classNameMap.entrySet().iterator();
		while (iter.hasNext()) {
			Map.Entry entry = (Map.Entry) iter.next();
			String key = entry.getKey().toString();
			if(entity.equals(entry.getValue().toString())){
				entity =key;
			}
		}
		return entity;
	}
	
}
